package com.taobao.txc.client.b;

import com.taobao.txc.a.b.g;
import com.taobao.txc.common.LoggerInit;
import com.taobao.txc.common.LoggerWrap;
import com.taobao.txc.common.TxcContext;
import com.taobao.txc.common.b.c;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.lang.StringUtils;

public class b
{
  private static final LoggerWrap a = LoggerInit.logger;
  private com.taobao.txc.client.a.a b = com.taobao.txc.client.a.a.a.c();
  private static AtomicInteger c = new AtomicInteger(0);
  
  public Object a(a parama, long paramLong, String paramString1, String paramString2)
  {
    int i = 1;
    try
    {
      if (g.h)
      {
        int j = c.get();
        if (j < 3) {
          try
          {
            this.b.a(paramLong, paramString1, paramString2);
            if (j > 0) {
              c.set(0);
            }
          }
          catch (Throwable localThrowable2)
          {
            int k = c.incrementAndGet();
            if (k > 2) {
              a.warn("continuous begin fail times:" + k);
            }
            throw localThrowable2;
          }
        } else {
          i = 0;
        }
      }
      else
      {
        this.b.a(paramLong, paramString1, paramString2);
      }
      Object localObject = parama.a();
      if (i != 0) {
        this.b.a();
      }
      return localObject;
    }
    catch (Throwable localThrowable1)
    {
      a.a("runATMT", localThrowable1.getMessage(), localThrowable1);
      ArrayList localArrayList = new ArrayList();
      Collections.addAll(localArrayList, localThrowable1.getStackTrace());
      Iterator localIterator = localArrayList.iterator();
      while (localIterator.hasNext())
      {
        StackTraceElement localStackTraceElement = (StackTraceElement)localIterator.next();
        if (StringUtils.endsWithIgnoreCase(localStackTraceElement.getClassName(), com.taobao.txc.common.b.a.class.getName())) {
          throw localThrowable1;
        }
      }
      try
      {
        if (i != 0) {
          this.b.b();
        }
      }
      catch (Throwable localThrowable3)
      {
        throw new com.taobao.txc.common.b.a(localThrowable3, false);
      }
      localArrayList.add(new StackTraceElement(com.taobao.txc.common.b.a.class.getName(), "RollbackTxcException", "RollbackTxcException.java", 0));
      localThrowable1.setStackTrace((StackTraceElement[])localArrayList.toArray(new StackTraceElement[0]));
      throw localThrowable1;
    }
  }
  
  public Object a(a parama, long paramLong)
  {
    try
    {
      TxcContext.a(paramLong);
      Object localObject1 = parama.a();
      Object localObject2 = localObject1;
      return localObject2;
    }
    catch (Throwable localThrowable)
    {
      throw c.a(localThrowable);
    }
    finally
    {
      TxcContext.f();
    }
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.client.b.b
 * JD-Core Version:    0.7.0.1
 */